package com.global.test.service.user.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.global.domain.User;
import com.global.test.dao.user.UserDAO;
import com.global.test.service.user.CifService;
import com.global.test.service.user.UserService;

/**   
 *  
 * @Description:  [一句话描述该类的功能]   
 * @Author:       [Joly]   
 * @CreateDate:   [2014年1月15日 下午3:59:45]   
 * @UpdateUser:   [Joly]   
 * @UpdateDate:   [2014年1月15日 下午3:59:45]   
 * @UpdateRemark: [说明本次修改内容]  
 * @Version:      [v1.0] 
 *    
 */
@Service
public class UserServiceImpl implements UserService {
	
	private UserDAO userDAO;
	private CifService cifService;

	public UserDAO getUserDAO() {
		return userDAO;
	}
	@Resource
	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}
	public CifService getCifService() {
		return cifService;
	}
	@Resource
	public void setCifService(CifService cifService) {
		this.cifService = cifService;
	}
	
	@Override
	public int add(User user) {
		cifService.add(user.getCif());
		return userDAO.insert(user);
	}

	@Override
	public int remove(User user) {
		return userDAO.delete(user);
	}

	@Override
	public int update(User user) {
		return userDAO.update(user);
	}

	@Override
	public User getUserByUsername(String username) {
		return userDAO.queryUserByUsername(username);
	}

	@Override
	public List<User> queryUsers(User user) {
		return userDAO.queryUsers(user);
	}

}
